﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="BooksByBibliophile.aspx.vb" Inherits="BooksReviewApp.BooksByBibliophile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="aside2">
        <br />
        <h3>Search</h3>
        <br />
        <br />
        <asp:TextBox ID="tb_search" runat="server" />
        <br />
        <table>
            <tr>
                <td>
                    <asp:Button ID="btn_findByName" runat="server" Text="By Name" CssClass="m-btn blue" />
                </td>
                <td>
                    <asp:Button ID="btn_findByCategory" runat="server" Text="By Category" CssClass="m-btn blue" />
                </td>
            </tr>
        </table>
        <br />
        <h3>
            Tag Cloud</h3>
        <div class="CloudBox">
            <br />
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:BooksReviewDBConnectionString1 %>"
                ProviderName="<%$ ConnectionStrings:BooksReviewDBConnectionString1.ProviderName %>" SelectCommand="SELECT BookTagJunction.Tag_FK, Count(BookTagJunction.Tag_FK) AS TotalTags, Tags.Tag
                            FROM Tags INNER JOIN BookTagJunction ON Tags.ID = BookTagJunction.Tag_FK
                            GROUP BY BookTagJunction.Tag_FK, Tags.Tag"></asp:SqlDataSource>
            <asp:Literal ID="CloudTags" runat="server"></asp:Literal>
        </div>
        <br />
        <h3>
            Language Cloud</h3>
        <div class="CloudBox">
            <br />
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:BooksReviewDBConnectionString1 %>"
                ProviderName="<%$ ConnectionStrings:BooksReviewDBConnectionString1.ProviderName %>" SelectCommand="SELECT * FROM CodingLanguage_Cloud WHERE IsVerified = 1"></asp:SqlDataSource>
            <asp:Literal ID="LanguageTags" runat="server"></asp:Literal>
        </div>
    </div>

    <h2 id="myHeading" runat="server">
    </h2>
    <asp:Button ID="btn_AddBook" runat="server" Text="Add Book" CssClass="m-btn purple"
        PostBackUrl="~/AddBook.aspx" />
    <div class="mainDiv2">
        <asp:ListView ID="ListView1" runat="server" DataKeyNames="ID" DataSourceID="SqlDataSource2">
            <ItemTemplate>
                <li class="hoverClass">
                    <asp:Label ID="lbl_Name" CssClass="BookNameLabel" runat="server" Text='<%# Eval("BookName") %>' />
                    <br />
                    <asp:Label ID="lbl_Category" CssClass="CategoryLabel" runat="server" Text='<%# Eval("Category") %>' />
                    <br />
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("ID", "BookDetails.aspx?ID={0}") %>' CssClass="NoLinks">
                        <img src='<%# Eval("Thumbnail") %>'  alt="No picture found"  width="100" height="100" style="border-style: solid; border-width: medium" />
                    </asp:HyperLink>
                    <br />
                    <asp:Label ID="lbl_Time" runat="server" Text='<%# CalculateTime.calculateTimeNoHours(Eval("DateAdded")) %>'
                        ForeColor="#7AC0DA" />
                    •
                    By •
                    <asp:HyperLink ID="HyperLink2" runat="server" Text='<%# Eval("Bibliophile")%>' NavigateUrl='<%# Eval("Bibliophile", "Profile.aspx?Bibliophile={0}") %>'
                        ForeColor="Red" Font-Bold="True" CssClass="red" Font-Size="Smaller">
                        <asp:Label ID="BibliophileLabel" CssClass="BookNameLabel" runat="server" Text='<%# Eval("Bibliophile") %>' />
                    </asp:HyperLink><br />
                </li>
            </ItemTemplate>
            <LayoutTemplate>
                <ul class="ItemContainer">
                    <li runat="server" id="itemPlaceholder" />
                </ul>
            </LayoutTemplate>
        </asp:ListView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:BooksReviewDBConnectionString1 %>"
            ProviderName="<%$ ConnectionStrings:BooksReviewDBConnectionString1.ProviderName %>" SelectCommand="SELECT * FROM [Books_Complete] WHERE Bibliophile = @Bibliophile AND IsVerified = 1 ORDER BY DateAdded DESC">
            <SelectParameters>
                <asp:QueryStringParameter Name="Bibliophile" QueryStringField="Bibliophile" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
        <br />
        <div class="nextLine">
            <asp:DataPager ID="DataPagerBooks" runat="server" PagedControlID="ListView1" PageSize="12">
                <Fields>
                    <asp:NextPreviousPagerField ShowFirstPageButton="True" ShowNextPageButton="False"
                        ButtonType="Link" ButtonCssClass="buttonDataPage" />
                    <asp:NumericPagerField ButtonType="Link" />
                    <asp:NextPreviousPagerField ShowLastPageButton="True" ShowPreviousPageButton="False"
                        ButtonType="Link" ButtonCssClass="buttonDataPage" />
                </Fields>
            </asp:DataPager>
        </div>
        <br />
    </div>
</asp:Content>
